<template>
  <el-card shadow="always" style="width: 76vw ; margin-top: 20px;">
    <div class="guide-grid">
        <div class="guide-card" v-for="(guide, index) in guides" :key="index">
          <div class="card-image">
            <img :src="guide.image" :alt="guide.title" />
            <span class="guide-badge">精选</span>
          </div>
          <div class="card-content">
            <h3>{{ guide.title }}</h3>
            <p>{{ guide.description }}</p>
            <div class="meta">
              <div class="author">
                <i class="fas fa-user-circle"></i>
                <span>{{ guide.author }}</span>
              </div>
              <div class="date">
                <i class="far fa-calendar-alt"></i>
                <span>{{ guide.date }}</span>
              </div>
            </div>
          </div>
        </div>
        <div class="guide-card new-guide-card" @click="createNewGuide">
          <div class="new-guide-content">
            <i class="fas fa-plus-circle"></i>
          </div>
        </div>
    </div>
  </el-card>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const guides = ref([
  {
    title: '7天玩转日本',
    description: '从东京到大阪，体验日本的美食与文化',
    image: 'path/to/japan-guide.jpg',
    author: '旅行达人',
    date: '2023-10-01',
  },
  {
    title: '西藏自驾攻略',
    description: '高原自驾，感受神秘西藏',
    image: 'path/to/tibet-guide.jpg',
    author: '自驾爱好者',
    date: '2023-09-15',
  },
  {
    title: '上海外滩一日游',
    description: '漫步外滩，感受上海的历史与现代交融',
    image: 'path/to/shanghai-bund.jpg',
    author: '城市探险家',
    date: '2023-11-20',
  },
  {
    title: '夜游上海外滩',
    description: '夜晚的外滩灯火辉煌，别有一番风味',
    image: 'path/to/shanghai-bund-night.jpg',
    author: '夜景摄影师',
    date: '2023-12-05',
  },
  {
    title: '上海外滩历史探秘',
    description: '探索外滩的历史建筑与故事',
    image: 'path/to/shanghai-bund-history.jpg',
    author: '历史爱好者',
    date: '2023-12-15',
  },
]);

const router = useRouter();
const createNewGuide = () => {
  router.push('/edit-guide');
};
</script>

<style scoped>
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.guide-gri.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

d {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.guide-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.guide-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.guide-card:hover .card-image img {
  transform: scale(1.05);
}

.card-content {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.card-content p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}

.guide-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: #0e9aa7;
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.guide-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  margin-top: auto;
  border-top: 1px solid #eee;
}

.guide-card .author,
.guide-card .date {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 0.9rem;
}

.new-guide-card {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f0f0f0;
  border: 2px dashed #ccc;
  cursor: pointer;
}

.new-guide-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0e9aa7;
  color: white;
  font-size: 2rem;
}
</style>